Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img14.360buyimg.com/n0/jfs/t1/235317/11/23375/373920/66b58eccF173d201c/9d527944fedc3c1c.png.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/159517/1/41980/6834/65bb06b7F4bf7e9b0/9bca4592c12de4e8.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/104788/36/46284/35142/65bb06b7F41684635/8205cb0d1ba6ff66.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/162568/18/42462/22767/65bb06b7F336209e0/dafc3b174db82c35.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/107926/4/40366/45101/65bb06b6F720aac28/f2dbadda526b3d40.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/89920/15/46308/16547/65bb06b6F9224803a/40072a8d9fc37da8.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/231662/27/13477/78055/65bb06b6F1e22fada/3c29a05c05b32203.jpg.avif ",     "https://img10.360buyimg.com/img/jfs/t1/106708/30/41882/55049/65bb0804Fd8090d84/72a07ceb1760d72c.jpg",
      "https://img10.360buyimg.com/img/jfs/t1/237484/20/12512/47636/65bb0803F9db1fd5e/b3e5761c9a7290c9.jpg",
      "https://img10.360buyimg.com/imgzone/jfs/t1/238109/37/16611/135841/6645b55eFaec144e0/4184b4dd9fe8a912.png",
      "https://img10.360buyimg.com/img/jfs/t1/240277/25/3917/29391/65bb0803Fa6f7d425/9107088badcac774.jpg",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})